
<%
	// Redirect to the home page if the user is not a manager.
	if (session.getAttribute("user_type") == null) {
		response.sendRedirect("no_permission.jsp");
	} else if (!session.getAttribute("user_type").equals("0")) {
		response.sendRedirect("index.jsp");
	}
%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" import="java.sql.*" import="Connect.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
<title>Hammer Time Auctions</title>
</head>
<%
	//Getting information for querying the database.
	java.sql.Connection conn = null;
	try {
		// Connect to the database.
		Class.forName(ConnectionInfo.myJDBCDriver()).newInstance();
		java.util.Properties sysprops = System.getProperties();
		sysprops.put("user", ConnectionInfo.myUserID());
		sysprops.put("password", ConnectionInfo.myPassword());
		conn = java.sql.DriverManager.getConnection(ConnectionInfo.myURL(), sysprops);

		java.sql.Statement statement = conn.createStatement();
		java.sql.ResultSet rs = statement.executeQuery("SELECT DISTINCT type FROM  items");
%>
<body>
	<div id="content">
		<%@include file="header.jsp"%>
		<h1>Searching by item type</h1>
		<hr></hr>
		<form action="dashboard.jsp">
			<table class="center">
				<tr>
					<td><input type="text" name="search" size="50"><select name="dff_cat1num" size="1">
							<%
								while (rs.next()) {
							%>
							<option value="<%=rs.getString(1)%>"><%=rs.getString(1)%></option>
							<%
								}
							%>
					</select><input type="submit" value="Search"></td>
				</tr>
			</table>
		</form>
	</div>
	<hr></hr>
	<%@include file="footer.jsp"%>
</body>
</html>
<%
	} catch (Exception e) {
		e.printStackTrace();
		out.print(e.toString());
	} finally {
		try {
			conn.close();
		} catch (Exception ee) {
		}
	}
%>